package com.jingdianjichi.wx.enums;

/**
 * 公众号消息类型枚举
 */
public enum WxChatMsgTypeEnum {
    //关注
    SUBSCRIBE("event.subscribe","用户关注事件"),

    //
    TEXT_MSG("text","接受用户文本消息");            //这些都是微信规定的亲

    private String msgType;

    private String desc;

    WxChatMsgTypeEnum(String msgType, String desc) {
        this.msgType = msgType;
        this.desc = desc;
    }

    //根据Key找到枚举
    public static WxChatMsgTypeEnum getByMsgType(String msgType){
        for (WxChatMsgTypeEnum wxChatMsgTypeEnum : WxChatMsgTypeEnum.values()) {
            if (wxChatMsgTypeEnum.msgType.equals(msgType)){
                return wxChatMsgTypeEnum;
            }
        }

        return null;
    }
}
